/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.bean.questionnaire;

import org.ipti.br.tag.bean.AppBaseBean;
import org.ipti.br.tag.bean.SessionBean;
import org.ipti.br.tag.bo.CampaignBO;
import org.ipti.br.tag.bo.HbBO;
import org.ipti.br.tag.bo.UnityBO;
import org.ipti.br.tag.entity.Campaign;
import org.ipti.br.tag.entity.Unity;
import org.ipti.br.tag.entity.enums.CampaignType;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import org.ipti.br.tag.util.ConsentTermAuxiliator;

/**
 *
 * @author FelipeMSX
 */
@ManagedBean(name="fillConsentTermB")
@ViewScoped
public class FillConsentTermBean extends AppBaseBean implements Serializable {
    
//    @Inject private SessionBean sessionBean;
//    @Inject private UnityBO unityBO;
//    @Inject private HbBO hbBO;
//    @Inject private CampaignBO campaignBO;
//    
//    private List <ConsentTermAuxiliator> consentTermListAuxiliator;
//    private Unity unity;
//    private Campaign campaign;
//    
//    private int year = getActualYear();
//   
//    @PostConstruct
//    public void init() {
//       this.consentTermListAuxiliator = new ArrayList<ConsentTermAuxiliator>();
//       this.campaign = null;
//       this.unity = null;
//    }
//    
//    public List<Unity> getUnityList() {
//        if (this.campaign != null) {
//            return unityBO.getClassLessonList(sessionBean.getLoggedActor().getUnity(),year);
//        } else {
//            return null;
//        }
//    }
//   
//    public List<Campaign> getCampaignList() {
//        return campaignBO.findAllCampaign(CampaignType.ANEMIA_FERROPRIVA);
//    }
//    
//    public void loadDataTable() {
//        if (campaign != null && unity != null) {
//            this.consentTermListAuxiliator = hbBO.getDataTableConsentTerm(campaign, unity);
//        }
//    }
//
//    public void saveHB() {
//        try {
//            hbBO.saveConsentTerm(consentTermListAuxiliator, campaign);
//            addInfoMessage(":fillConsentForm:message", "Sucesso", "Salvo com sucesso no servidor");
//        } catch(Exception e) {
//            e.printStackTrace();
//            addErrorMessage(":fillConsentForm:message", "Erro ao salvar os dados no servidor", "Não foi possível salvar");
//        }
//    }
//   
//    public void print() {
//        boolean sucess = hbBO.printConsentTerm(consentTermListAuxiliator, campaign, unity, sessionBean.getLoggedActor().getUnity());
//        if (sucess) {
//            addInfoMessage(":createConsentForm:message", "Sucesso!", "Os relatórios gerados estão lindos, né?");
//        } else {
//            addErrorMessage(":createConsentForm:message", "Ocorreu algum provlema ao gerar os relatórios", ":(");
//        }
//    }
//   
//    public boolean activeBottoms() {
//        return ( (this.consentTermListAuxiliator.isEmpty()) || (this.campaign == null) || (this.unity == null) );
//    }
//   
//    public boolean activeUnity() {
//        return  ( this.campaign  == null );   
//    }
//
//    public SessionBean getSessionBean() {
//        return sessionBean;
//    }
//
//    public void setSessionBean(SessionBean sessionBean) {
//        this.sessionBean = sessionBean;
//    }
//
//    public List<ConsentTermAuxiliator> getConsentTermListAuxiliator() {
//        return consentTermListAuxiliator;
//    }
//
//    public void setConsentTermListAuxiliator(List<ConsentTermAuxiliator> consentTermListAuxiliator) {
//        this.consentTermListAuxiliator = consentTermListAuxiliator;
//    }
//
//    public Unity getUnity() {
//        return unity;
//    }
//
//    public void setUnity(Unity unity) {
//        this.unity = unity;
//    }
//
//    public Campaign getCampaign() {
//        return campaign;
//    }
//
//    public void setCampaign(Campaign campaign) {
//        this.campaign = campaign;
//    }
//
//    public int getYear() {
//        return year;
//    }
//
//    public void setYear(int year) {
//        this.year = year;
//    }
}